import { exportExcel } from '../fn/exportExcel'
const fs = require('fs');
const XLSX = require('xlsx');

describe('exportExcel function test', () => {
  test('should export Excel file successfully', () => {
    const data = [
      { Project: 'Project A', Result: 'Pass' },
      { Project: 'Project B', Result: 'Fail' },
    ];
    const baseUrl = '';
    const name = 'test';
    const flag = false;

    exportExcel(data, baseUrl, name, flag).then(res => {
      if (res) {
        const filePath = `${baseUrl}/${name}${flag ? date : ''}.xlsx`;
        const fileExists = fs.existsSync(filePath);
        console.log(fileExists)

        expect(fileExists).toBe(true);
      }
    })
  });
});